package PangModel;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 * Created by loren on 07.05.2015.
 */
public class ImageStore {
    public static final int IMAGE_HERO_STABLE = -1;
    private static BufferedImage heroStable;

    public static final int IMAGE_HERO_RIGHT = 1;
    private static BufferedImage heroRight;

    public static final int IMAGE_HERO_LEFT = 2;
    private static BufferedImage heroLeft;

    public static final int IMAGE_BALL_BIG = 3;
    private static BufferedImage ballBig;

    public static final int IMAGE_BALL_MID = 4;
    private static BufferedImage ballMid;

    public static final int IMAGE_BALL_SMALL = 5;
    private static BufferedImage ballSmall;

    public static final int IMAGE_ROPE_STICKY_HEAD= 6;
    private BufferedImage ropeStickyHead;

    public static final int IMAGE_ROPE_STICKY_TAIL= 7;
    private BufferedImage ropeStickyTail;

    public static final int IMAGE_ROPE_HEAD= 8;
    private static BufferedImage ropeHead;

    public static final int IMAGE_NULL = 9;
    private BufferedImage nullImage;

    public static final int IMAGE_MG_BULLET= 10;
    private BufferedImage mgBullet;

    public static final int IMAGE_DESTRUCTABLE_BARRIER_TOUGH= 11;
    private BufferedImage dBarrierTough;

    public static final int IMAGE_DESTRUCTABLE_BARRIER_BROKEN= 11;
    private BufferedImage dBarrierBroken;


    public ImageStore()
    {
        try {
            heroStable = ImageIO.read(new File("/home/baraaorabi/pang/src/PangModel/hello.png"));
            ballBig =  ImageIO.read(new File("/home/baraaorabi/pang/src/PangModel/ballBig.png"));
            ropeHead = ImageIO.read(new File("/home/baraaorabi/pang/src/PangModel/bullet.png"));
            ballMid = ImageIO.read(new File("/home/baraaorabi/pang/src/PangModel/ballMid.png"));
            ballSmall = ImageIO.read(new File("/home/baraaorabi/pang/src/PangModel/ballSmall.png"));
//            nullImage = ImageIO.read(new File("/home/loren/Desktop/pangGame/src/PangModel/Mario_8Bit.png"));
            /*heroRight = ImageIO.read(new File("Mario_8Bit.png"));
            heroLeft = ImageIO.read(new File("Mario_8Bit.png"));
            ballBig = ImageIO.read(new File("Mario_8Bit.png"));
            ballMid = ImageIO.read(new File("Mario_8Bit.png"));
            ballSmall = ImageIO.read(new File("Mario_8Bit.png"));*/
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static BufferedImage getImage(int imageID) throws UnsupportedArgumentException {
        switch (imageID)
        {
            case IMAGE_HERO_STABLE:
                return heroStable;
            case IMAGE_BALL_BIG:
                return ballBig;
            case IMAGE_BALL_MID:
                return ballMid;
            case IMAGE_BALL_SMALL:
                return ballSmall;
            case IMAGE_HERO_LEFT:
                return heroLeft;
            case IMAGE_HERO_RIGHT:
                return heroRight;
            case IMAGE_ROPE_HEAD:
                return ropeHead;
            default:
                throw new UnsupportedArgumentException("Unsupported argument for ImageStore getImage method: " + imageID);
        }
    }
}
